<!-- 买单商品 -->
<template>
    <div class="page-box h100 display-flex czbj">
      <p class="title-label mb10">买单商品</p>
      <!-- sonRouter="yybureauFormationBJ" 为跳转新的页面编辑 -->
      <dxtable
        :dataJson="dataJson"
        :portUrl="portUrl"
        :formJson="formJson"
        :qx="qx"
        ref="databale"
      ></dxtable>
    </div>
  </template>
  <script lang="ts" setup>
  import dxtable from "../../components/util/dxtable.vue";
  import sort from "../../components/util/sort.vue";
  import { dxget, dxpost } from "../../util/index";
  import { NButton, NImage, NTag } from "naive-ui";
  import { h, ref, reactive } from "vue";
  import { Options } from "@vicons/ionicons5";
  const databale = ref();
  const initeer = () => {
    databale.value.initDataExpose();
  };
  let dataJson = [
    {
      title: "商品名称",
      type: "input",
      val: "",
      icon: "dx-shurukuang",
      span: 24,
      key: "title",
      width: "",
      search: true,
      istable: true,
      required: false,
    },
    {
      title: "分期数",
      type: "select",
      icon: "dx-radiobox",
      val: "",
      width: "80",
      options: [
        {
          label: "全部",
          value: "",
        },
        {
          label: "3期",
          value: "3",
        },
        {
          label: "6期",
          value: "6",
        },
      ],
      key: "qishu",
      search: true,
    },
  
    {
      title: "累计销量",
      key: "",
      width: 80,
      render(h) {
        return 0;
      },
    },
    {
      title: "添加时间",
      key: "addTime",
      width: 150,
    },
  ];
  
  let qx = {
    DeletePermissionID: "23456", //删除
    EditPermissionIdentifier: "meirongmaidanbj", // 编辑
    NewPermissionIdentifier: "23456", // 新建
    ViewPermissionID: "meirongmaidanck", // 查看
  };
  let portUrl = "meirong/maidan/maidan?zzhn="+localStorage.Userid;
  if (localStorage.id == 92) {
    portUrl = "meirong/maidan/maidan?uid=" + localStorage.Userid;
    qx = {
      DeletePermissionID: "meirongmaidandel", //删除
      EditPermissionIdentifier: "meirongmaidanbj", // 编辑
      NewPermissionIdentifier: "meirongmaidanxz", // 新建
      ViewPermissionID: "meirongmaidanck", // 查看
    };
  }
  
  let formJson = reactive([
    {
      title: "商品名称",
      type: "input",
      val: "",
      icon: "dx-shurukuang",
      span: 24,
      key: "title",
      width: "",
      search: false,
      istable: true,
      required: true,
    },
  
    {
      title: "扣款类型",
      type: "radio",
      icon: "dx-radiobox",
      val: "1",
      bjzj: true,
      opt: [
        {
          label: "天",
          value: "1",
        },
        {
          label: "周",
          value: "2",
        },
        {
          label: "月",
          value: "3",
        },
        {
          label: "季",
          value: "4",
        },
        {
          label: "年",
          value: "5",
        },
      ],
      span: 14,
      key: "koukuanlx",
      width: "",
      search: false,
      istable: true,
      required: false,
    },
    {
      title: "分期数",
      type: "select",
      icon: "dx-radiobox",
      val: "3",
      bjzj: true,
      options: [
        {
          label: "2期",
          value: "2",
        },
        {
          label: "3期",
          value: "3",
        },
        {
          label: "4期",
          value: "4",
        },
        {
          label: "5期",
          value: "5",
        },
        {
          label: "6期",
          value: "6",
        },
        {
          label: "7期",
          value: "7",
        },
        {
          label: "8期",
          value: "8",
        },
        {
          label: "9期",
          value: "9",
        },
        {
          label: "10期",
          value: "10",
        },
        {
          label: "11期",
          value: "11",
        },
        {
          label: "12期",
          value: "12",
        },
      ],
      span: 10,
      key: "qishu",
      width: "",
      search: false,
      istable: true,
      required: false,
    },
  
    {
      title: "首次扣款时间",
      type: "radio",
      icon: "dx-radiobox",
      val: "0",
      bjzj: true,
      opt: [
        {
          label: "签约当天",
          value: "0",
        },
        {
          label: "1天后",
          value: "1",
        },
        {
          label: "2天后",
          value: "2",
        },
        {
          label: "3天后",
          value: "3",
        },
        {
          label: "4天后",
          value: "4",
        },
        {
          label: "5天后",
          value: "5",
        },
        {
          label: "6天后",
          value: "6",
        },
        {
          label: "7天后",
          value: "7",
        },
        {
          label: "8天后",
          value: "8",
        },
        {
          label: "9天后",
          value: "9",
        },
        {
          label: "10天后",
          value: "10",
        },
        {
          label: "15天后",
          value: "15",
        },
        {
          label: "30天后",
          value: "30",
        },{
          label: "60天后",
          value: "60",
        },
      ],
      span: 24,
      key: "sckksj",
      width: "",
      search: false,
      istable: true,
      required: false,
    },
  
    
    {
      title: "uid",
      type: "",
      val: localStorage.Userid,
      key: "uid",
    },
    {
      title: "",
      val: localStorage.id,
      key: "spid",
    },
  ]);
  const czFun = {
    fun: (row) => {
      return [
        h(
          NButton,
          {
            type: "info",
            quaternary: true,
            onClick: async (e) => {},
          },
          "复制代码"
        ),
      ];
    },
  };
  
  // 获取字典内容
  // const xtgxxmfl = async () => {
  //   const { data }: any = await dxget("dxgjAdmin/getzd", { name: 'xtgxxmfl' })
  //   dataJson[2].options = [
  //     {
  //       label: "全部",
  //       value: ""
  //     },
  //     ...data
  //   ]
  //   formJson[2].options = data
  //   xmlxSelect.value = data
  //   console.log(data);
  // }
  // xtgxxmfl()
  </script>
  <style scoped></style>
  